package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

//import Common.Role;
import Entity.Worker;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

/**
 * this is the GUI for viewing more details about a worker.
 * @author Sandra Karsko
 *
 */
public class ViewWorker extends JFrame {

	private JPanel contentPane;
	private JTextField WorkerID;
	private JTextField FirstName;
	private JTextField LastName;
	private JTextField Mail;
	private JTextField RoleW;
	private JTextField WorkerNum;


	/**
	 *  is the constructor. it has a table to chose from and save after validate.
	 */
	public ViewWorker(Worker w) {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 449, 249);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblEmployeeDetails = new JLabel("Employee Details");
		lblEmployeeDetails.setBounds(172, 11, 129, 14);
		contentPane.add(lblEmployeeDetails);
		
		JLabel lblWorkerId = new JLabel("Worker ID:");
		lblWorkerId.setBounds(10, 49, 65, 14);
		contentPane.add(lblWorkerId);
		
		WorkerID = new JTextField();
		WorkerID.setBounds(89, 46, 86, 20);
		contentPane.add(WorkerID);
		WorkerID.setColumns(10);
		WorkerID.setText(w.getWorkerID());
		WorkerID.setEditable(false);
		
		JLabel lblFirstName = new JLabel("First Name:");
		lblFirstName.setBounds(10, 74, 77, 14);
		contentPane.add(lblFirstName);
		
		FirstName = new JTextField();
		FirstName.setBounds(89, 71, 86, 20);
		contentPane.add(FirstName);
		FirstName.setColumns(10);
		FirstName.setText(w.getFirstName());
		FirstName.setEditable(false);
		
		JLabel lblLastName = new JLabel("Last Name:");
		lblLastName.setBounds(10, 99, 77, 14);
		contentPane.add(lblLastName);
		
		LastName = new JTextField();
		LastName.setColumns(10);
		LastName.setBounds(89, 96, 86, 20);
		contentPane.add(LastName);
		LastName.setText(w.getLastName());
		LastName.setEditable(false);
		
		JLabel lblEmail = new JLabel("E-Mail:");
		lblEmail.setBounds(10, 146, 46, 14);
		contentPane.add(lblEmail);
		
		Mail = new JTextField();
		Mail.setBounds(69, 146, 152, 20);
		contentPane.add(Mail);
		Mail.setColumns(10);
		Mail.setText(w.getEmail());
		Mail.setEditable(false);
		
		JLabel lblRoleW = new JLabel("Role:");
		lblRoleW.setBounds(10, 121, 46, 14);
		contentPane.add(lblRoleW);
		
		RoleW = new JTextField();
		RoleW.setBounds(69, 121, 137, 20);
		contentPane.add(RoleW);
		RoleW.setColumns(10);
		switch(w.getR())
		{
		case ServiceClassWorker:
			RoleW.setText("Service Class Worker");
			break;
		case parkingLotWorker:
			RoleW.setText("Parking Lot Worker");
			break;
		case parkingLotManager:
			RoleW.setText("ParkingLotManager");
			break;
		case companyManager:
			RoleW.setText("Company Manager");
		}
		RoleW.setEditable(false);
		
		JLabel lblEmployeeNumber = new JLabel("Employee Number:");
		lblEmployeeNumber.setBounds(205, 49, 108, 14);
		contentPane.add(lblEmployeeNumber);
		
		WorkerNum = new JTextField();
		WorkerNum.setBounds(322, 46, 86, 20);
		contentPane.add(WorkerNum);
		WorkerNum.setColumns(10);
		WorkerNum.setText(String.valueOf(w.getWorkerNum()));
		WorkerNum.setEditable(false);
		
		JButton btnReturn = new JButton("Return");
		btnReturn.setBounds(172, 175, 89, 23);
		contentPane.add(btnReturn);
	}

}
